package com.dingyuhang.service.impl;


import com.dingyuhang.bean.Reply;
import com.dingyuhang.mapper.ReplyMapper;
import com.dingyuhang.mapper.TopicMapper;
import com.dingyuhang.service.ReplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service

public class ReplyServiceImpl implements ReplyService {
	
	@Autowired
	private ReplyMapper replyMapper;
	
	@Autowired
	private TopicMapper topicMapper;
	
	@Override
	public int countReply(Integer id) {
		return replyMapper.countReply(id);
	}
	
	
	@Override
	public void replying(Reply reply) {
		
		topicMapper.updateFloors(reply.getTopic().getId(),reply.getFloor()); //修改灰灰表的楼层数
		replyMapper.replying(reply);//添加到回复表
	}

}
